// File Name: SecondViewController.h
// Team: Team Epsilon
// Date Created: 2009/07/15
// Purpose: The Level2 of the adventure mode. 
// Change History: 
//   * James, Date: 2009/07/15 Create File
//   * James, Date: 2009/07/15 Create Level
//   * James, Date: 2009/07/16 Adding comment
//************************************************
//

#import <UIKit/UIKit.h>


@interface Level2ViewController : UIViewController 
{
	UIAlertView *usageAlertView;
	BOOL showUsageAlert;
		
	// the timer
	IBOutlet UILabel *countdownLabel;
	IBOutlet UILabel *msgLabel;
	int iniSec;
	int score1;
	BOOL timeUP;
	BOOL gameIsPlaying;
	int alertFlag;
	NSTimer *timer;
	
	// players of the level
	//   more player will be added here
	IBOutlet UIImageView *water1;
	IBOutlet UIImageView *water2;
	IBOutlet UIImageView *fire1;
	IBOutlet UIImageView *fire2;
	IBOutlet UIImageView *grass1;
	
	//player start position
	IBOutlet UIImageView *water1_stpos;
	IBOutlet UIImageView *water2_stpos;
	IBOutlet UIImageView *fire1_stpos;
	IBOutlet UIImageView *fire2_stpos;
	IBOutlet UIImageView *grass1_stpos;	
		
	// initial positions;
	CGPoint water1_cord;
	CGPoint water2_cord;
	CGPoint fire1_cord;
	CGPoint fire2_cord;
	CGPoint grass1_cord;

	// last positions recorder;
	CGPoint last_water1_cord;
	CGPoint last_water2_cord;
	CGPoint last_fire1_cord;
	CGPoint last_fire2_cord;
	CGPoint last_grass1_cord;
	CGPoint offScreenPoint;
	
	//initial position for checking where it can be moved
	CGPoint water1_stpos_cord;
	CGPoint water2_stpos_cord;
	CGPoint fire1_stpos_cord;
	CGPoint fire2_stpos_cord;
	CGPoint grass1_stpos_cord;
	
	//current position of the element in the node
	CGPoint water1_curr_cord;
	CGPoint water2_curr_cord;
	CGPoint fire1_curr_cord;
	CGPoint fire2_curr_cord;
	CGPoint grass1_curr_cord;				
	
	// how many kills record
	int kills;
	
	// check if player wins the game
	BOOL isWin;
	
}
	
// Action for interface builder
// Action for login button
- (IBAction)loginx:(id)sender;
	
// Action for go to the next level
- (IBAction) nextlevel:(id)sender;
	
// Action for go to the previous level
- (IBAction) prevlevel:(id)sender;
	
// timer 
// set the initial time
-(void)setIniTime;
	
//update the time
-(void)updateLabel;
	
// do something after time's up
-(IBAction)doSomething:(id)sender;
	
// action for start the game
- (IBAction)startCount:(id)sender;
	
// timer initial time in miliseconds
@property int iniSec;
	
// score
@property int score1;
	
//boolean to check if time's up
@property BOOL timeUP;
	
// boolean to check if the game is still playing
@property BOOL gameIsPlaying;
// timer ends
	
// using the buildin popup window
@property (nonatomic, retain) UIAlertView *usageAlertView;
	
// show the buildin popup window
@property BOOL showUsageAlert;
	
// the flag for alert to show
@property int alertFlag;
	
@end
